﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace University.Workshop.Presenters.Cistern.Read
{
    public class PresenterReadCistern
    {
        IReadBasicCistern viewReadBasic;
        Model.Cistern newCistern = new Model.Cistern() { Person = new Model.Person() };
        IReadPrincipalView view;
        public PresenterReadCistern(IReadPrincipalView View, Model.Cistern cistern)
        {
            view = View;
            newCistern = cistern;           
        }

        public void FirstTime()
        {
            view.CallFirstPage();
            ProcedureAfterCall();
        }

        public void GoBackPage()
        {
            viewReadBasic.GoBackPage();
        }

        public void GoNextPage()
        {
            viewReadBasic.GoNextPage();
        }

        public void GoStepOne()
        {
            newCistern = view.RedBasic.CisternToRead;
            view.CallFirstPage();
            ProcedureAfterCall();
        }

        public void GoStepTwo()
        {
            newCistern = view.RedBasic.CisternToRead;
            view.CallSecondPage();
            ProcedureAfterCall();
        }

        private void ProcedureAfterCall()
        {

            if (viewReadBasic != null)
                newCistern = viewReadBasic.CisternToRead;
            viewReadBasic = view.RedBasic;
            viewReadBasic.CisternToRead = newCistern;
            viewReadBasic.Update();
        }
    }
}
